<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld" %>
<%@ taglib uri="/WEB-INF/tld/jmesa.tld" prefix="jmesa" %> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><strong>帖子信息</strong></title>
<link href="/estate/css/index.css" rel="stylesheet" type="text/css">
<link href="/estate/css/css.css" rel="stylesheet" type="text/css">
<script src="/estate/js/meizzDate.js"></script>
<script type="text/javascript" src="/estate/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/estate/js/jquery-1.2.2.pack.js"></script>
    <script type="text/javascript" src="/estate/js/jquery-1.3.min.js"></script> 
    <script type="text/javascript" src="/estate/js/jquery.jmesa.js"></script>
    <script type="text/javascript" src="/estate/js/jmesa.js"></script>              
    <link rel="stylesheet" type="text/css" href="/estate/css/jmesa.css"></link>
<script type="text/javascript">
	function updateAnnouncement(form){
		form.action="/estate/admin/announcementAction.action?method=modify";
   		form.submit();
	}
	function postAnnouncement(form){
		form.action="/estate/admin/announcementAction.action?method=post&state=2";
   		form.submit();
	}
	function showComment(){
		var comment = document.getElementById("comment");
		var replyId = document.getElementById("replyId");
		var forumId = document.getElementById("forumId");
		var id = document.getElementById("id");
		
		replyId.value="0";
		
		var editor = CKEDITOR.instances.commentContent;
		editor.setData("");

		var commentAdd = document.getElementById("commentAdd");
		var commentUpdate = document.getElementById("commentUpdate");
		commentAdd.style.display="block";
		commentUpdate.style.display="none";
		
		forumId.value=id.value;
		if(comment.style.display=="none"){
			var commentTitle = document.getElementById("commentTitle");
			commentTitle.value="回复楼主";
			
			comment.style.display="block";
			window.location = "#commentDiv";
		}else{
			comment.style.display="none";
			window.location = "#";
		}
		
	}
	function replyComment(reply,floor){
		var comment = document.getElementById("comment");
		var replyId = document.getElementById("replyId");
		replyId.value=reply;
		
		var commentTitle = document.getElementById("commentTitle");
		
		var editor = CKEDITOR.instances.commentContent;
		editor.setData("");
		
		var commentAdd = document.getElementById("commentAdd");
		var commentUpdate = document.getElementById("commentUpdate");
		commentAdd.style.display="none";
		commentUpdate.style.display="block";
		
		commentTitle.value="回复"+floor;
		comment.style.display="block";
		window.location = "#commentDiv";
	}
	function comment(form){
		//var editor = CKEDITOR.instances.commentContent;
		//alert(editor.getData());
		form.action="/estate/admin/commentAction.action?method=add";
   		form.submit();
	}
	function updateComment(content,floor,id){
		var comment = document.getElementById("comment");
		var commentTitle = document.getElementById("commentTitle");
		
		var updateCommentId = document.getElementById("updateCommentId");
		updateCommentId.value=id;
		
		var editor = CKEDITOR.instances.commentContent;
		editor.setData(content);
		
		var commentAdd = document.getElementById("commentAdd");
		var commentUpdate = document.getElementById("commentUpdate");
		commentAdd.style.display="none";
		commentUpdate.style.display="block";
		
		commentTitle.value="回复"+floor;
		comment.style.display="block";
		window.location = "#commentDiv";
	}
	function updateCommentAction(form){
		form.action="/estate/admin/commentAction.action?method=update";
   		form.submit();
	}
</script>
</head>
<body>
<form name="form1" id="form1" method="post" action="">
<table border="0" cellpadding="0" cellspacing="0" style="background-image:url(/estate/images/gtbg.gif) " width="100%">
    <tr>
      <td width="50%" height="82" rowspan="2"><img src="/estate/images/guide_01.gif"></td>
      <td width="50%" style="background-image:url(/estate/images/guide_02.gif);color:#cc1212; font-size:16px; font-weight:bold; text-align:right; padding-right:50px; letter-spacing:1px; " height="39"><strong>业务论坛</strong></td>
    </tr>
     <tr><td width="50%" style="background-image:url(/estate/images/guide_03.gif); height:43px;" align="center" valign="middle">
	  <table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr align="center">
          <td><input name="Submit1" type="button" onFocus="this.blur();" class="button2" value="发表文章" > </td>
          <td><input type="button" name="Submit2" onFocus="this.blur();" value="回复文章" class="button2" onclick="showComment()"> </td>
        </tr>
      </table></td>
    </tr>
</table><br>
<table width="80%" align="center" border="0" cellspacing="0" cellpadding="0" class="main">
	<input type="hidden" name="id" id="id" value="${fda.forum.id }"/>
  <tr align="center">
    <td colspan="2" class="tableTitle" style="text-align:left;vertical-align:super;">
    	<div style="float:left;width:40%;">&nbsp;标题：${fda.forum.title }</div>
    	<c:if test="${fda.forum.postUser.id eq sessionScope.sessionUser.id}">
			<div style="float:left;text-align:right;width:60%">
				<a href="/estate/admin/forumAction.action?method=modify&id=${fda.forum.id }">修改</a>&nbsp;&nbsp;
				<a href="/estate/admin/forumAction.action?method=delete&id=${fda.forum.id }">删除</a>&nbsp;&nbsp;
			</div>
		</c:if>
    </td>
  </tr>
  
  <tr>
 	<td rowspan="2" width="140"  style="height:170px;" align="right" class="two">
 		<div align="center">
 			<br/>
 			<span>${fda.forum.postUser.loginName }</span><br>
 			<img src="/estate/images/room.jpg"/><br>
 		</div>
	</td>
   <td colspan="1" align="left" class="two"  style="height:20px;">
	   <div style="float:left;width:40%;">&nbsp;&nbsp;<img style="border:none;" src="/estate/images/small-comment.gif"/>&nbsp;发表于：${fda.forum.postDate }</div>
	   <div style="float:left;width:60%; text-align: right;">阅读数：${fda.forum.readNum }&nbsp;&nbsp;回复数：${fda.forum.commentNum }&nbsp;&nbsp;<a href="#"><img style="border:none;" src="/estate/images/p_up.gif"/></a>&nbsp;&nbsp;楼主&nbsp;&nbsp;</div>
   	</td>
  </tr>
  <tr>
    <td colspan="1" align="left" class="two" style="height:100px;vertical-align: top;">
    	<div align="left">
 			<div style="font-weight: bold;margin-top:10px;margin-left:10px;">${fda.forum.title }:</div><br>
 			<div style="margin-left:20px;">${fda.forum.content }</div><br>
 		</div>
	</td>
  </tr>
 
</table><br>
</form>
<!-- 帖子结束 -->

<form  id="form2"  name="form2" action="" method="post">
<div align="center" >
	<div class="main" align="center" style="width:1000px;height:400px;">
      <jmesa:struts2TableModel items="${fda.commentList}" id="comment_table"  var="bean" stateAttr="restore" toolbar="com.estate.utils.JmesaForumToolBar" >
          <jmesa:htmlTable width="90%" style="text-align:center;" caption="<div style='height:20px;text-align:center;'>所有评论</div>">
              <jmesa:htmlRow uniqueProperty="id">
              	  <jmesa:htmlColumn width="100%" property="" sortable="false" title=""  editable="false" filterable="false">
              	  <div>
              	  <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" style="border-left: 1px solid #508fb6;border-top: 1px solid #508fb6;">
						<input type="hidden" name="id" id="id" value="${bean.id }"/>
					  <tr align="center">
					    <td colspan="2" class="tableTitle" style="text-align:left;vertical-align:super;padding: 0px; border:  1px solid #508fb6;">
					    	<div style="float:left;width:40%;">&nbsp;${bean.commentTitle }</div>
					    	<c:if test="${bean.commentUser.id eq sessionScope.sessionUser.id}">
						    	<div style="float:left;text-align:right;width:60%">
						    		<a href="javascript:updateComment('${bean.content}' ,'${bean.floor}',${bean.id})">修改</a>&nbsp;&nbsp;
						    		<a href="/estate/admin/commentAction.action?method=delete&id=${bean.id}">删除</a>&nbsp;&nbsp;
						    	</div>
					    	</c:if>
					    	
					    </td>
					  </tr>
					  <tr style="border:0px">
					 	<td rowspan="2" width="1000px"  class="two" align="left" style="padding: 0px; border: 0px;">
					 		<div style="height:200px;width:1000px;border-bottom: 1px solid #508fb6;">
									<div style="height:100%;width:130px;float:left;border: none;">
										<div align="center" style="border: none">
								 			<br/>
								 			<span>${bean.commentUser.loginName }</span><br>
								 			<img src="/estate/images/headphoto.jpg"/><br>
								 		</div>
									</div>
									<div style="height:200px;width:870px;float:left;border-bottom: none;">
										<div style="height:25px;width:870p;float:top;border: 1px solid #508fb6;border-top:none;">
											<div style="margin-top:4px; float:left;"><a href="#">&nbsp;&nbsp;<img style="border:none;" src="/estate/images/small-comment.gif"/></a></div>
											<div style="margin-top:7px; float:left;">&nbsp;回复日期：${bean.commentDate }</div>
											<div style="text-align: right;">
												<span>
													<a href="javascript:replyComment('${bean.id}' ,'${bean.floor}')">回复</a>&nbsp;&nbsp;
												</span>
												<span><a href="#"><img style="border:none;padding-top:2px" src="/estate/images/p_up.gif"/></a>&nbsp;&nbsp;</span>
												<span style="font-style: italic;">${bean.floor }&nbsp;&nbsp;</span>
											</div>
										</div>
										<div style="height:175px;width:870p;float:top;border: 1px solid #508fb6;border-top:none;border-bottom: none;">
											<div align="left"><br>
									 			<span style="font-weight: bold;">&nbsp;&nbsp;${bean.commentTitle } :</span>
									 			<div style="margin-left:20px;">${bean.content }
		<!-- 下为回复小div -->
		<c:if test="${bean.replyId ne '0'}">
			<div class="b" style="width: 650px">
			<div style="height:1px;width:60px;margin-left: 35px;">
				<DIV
					style="OVERFLOW: hidden; WIDTH: 1px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 2px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 3px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 4px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 5px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 6px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 7px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 8px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 9px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 10px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 11px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 12px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 13px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 14px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 15px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 16px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
			</div>
			<DIV align=center>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 580px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 584px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 588px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 590px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 592px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 594px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 596px; HEIGHT: 2px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 598px; HEIGHT: 2px; BACKGROUND-COLOR: #E3E3E3"></DIV>
					
				<DIV style="WIDTH: 600px; HEIGHT: 60px; BACKGROUND-COLOR: #E3E3E3"
					align=left>

					${bean.title }
				</DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 598px; HEIGHT: 2px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 596px; HEIGHT: 2px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 594px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 592px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 590px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 588px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 584px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
				<DIV
					style="OVERFLOW: hidden; WIDTH: 580px; HEIGHT: 1px; BACKGROUND-COLOR: #E3E3E3"></DIV>
			</DIV>
		</div>
		</c:if>
									 			</div><br>
									 		</div>
										</div>
									</div>
							</div>
							
						</td>
					   
					  </tr>
					</table><br>
              	  </div>
              	  </jmesa:htmlColumn>
              </jmesa:htmlRow>
          </jmesa:htmlTable>
      </jmesa:struts2TableModel>
      </div>
</div>

  </form>


<!-- 下为评论 -->

<form  id="form3"  name="form3" action="" method="post">
<a name="commentDiv"></a>
<div id="comment" style="display: none;">
<table width="80%" align="center" border="0" cellspacing="0" cellpadding="0" class="main">
<input type="hidden" id="updateCommentId" name="id"/>
<input type="hidden" id="replyId" name="replyId"/>
<input type="hidden" id="forumId" name="forumId" value="${fda.forum.id }"/>
  <tr align="center">
    <td colspan="4" class="tableTitle">回复帖子</td>
  </tr>
  <tr>
    <td width="10%" align="right" class="two" >回复：</td>
    <td width="90%" class="two" align="left"><input name="title" readonly="readonly" id="commentTitle" type="text" class="input" style="width: 400px"></td>
  </tr>
  
  <tr style="height:360px" >
    <td width="10%" align="right" class="two">内容：</td>
    <td width="90%" class="two" align="left">
    	
		<textarea class="ckeditor" cols="80" id="commentContent" name="content" rows="10"></textarea>
    </td>
  </tr>
  <tr>
  	
  	<td colspan="2" class="two" align="center">
  		<div id="commentAdd">
	  		<input type="button" name="Submit2" onFocus="this.blur();" value="评论" class="button2" onclick="comment(form3)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	  		<input type="reset" name="Submit3" onFocus="this.blur();" value="重置" class="button2">
	  	</div> 
	  	<div id="commentUpdate">
	  		<input type="button" name="Submit2" onFocus="this.blur();" value="更新" class="button2" onclick="updateCommentAction(form3)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	  		<input type="reset" name="Submit3" onFocus="this.blur();" value="重置" class="button2">
	  	</div>
  	</td>
  	
  </tr>
 
  <tr><td class="two" colspan="2">&nbsp;</td></tr>
</table><br>
</div>
</form>
</body>
<script type="text/javascript">
      function onInvokeAction(id){
          $.jmesa.setExportToLimit(id,'');
          $.jmesa.createHiddenInputFieldsForLimitAndSubmit(id);
      }  
      function onInvokeExportAction(id) {
			var parameterString = $.jmesa.createParameterStringForLimit(id);
			location.href = "testAction.action?method=export&" + parameterString;
      }
  </script>
</html>
